﻿using System;
using System.Collections.Generic;
using System.Text;
using Store.Dal;
using Store.Model.Models;
using Store.ViewModel;

namespace Store.Bll
{
    public class PromotionBLL
    {
        private PromotionDAL dal;
        public PromotionBLL(PromotionDAL _dal)
        {
            dal = _dal;
        }
        //显示
        public List<Promotion> GetPromotions(string Ptitle = "", int Pstate = 0)
        {
            var data = dal.GetPromotions(Ptitle, Pstate);
            return data;
        }
        //添加
        public int AddPromotions(Promotion pro)
        {
            pro.CreateTime = DateTime.Now;
            pro.PastdueTime = DateTime.Parse("2021-05-01");
            pro.CreatePeople = "管理员";
            pro.PalterTime = DateTime.Now;
            pro.PalterPeople = "管理员";
            pro.PromoDelState = 1;
            return dal.AddPromotions(pro);
        }
        //删除
        public int DelPromotions(int id)
        {
            return dal.DelPromotions(id);
        }
        //修改
        public int UpdatePromotions(Promotion pro)
        {
            return dal.UpdatePromotions(pro);
        }

        //显示商品
        public List<CommodityModel> GetCommodities()
        {
            return dal.GetCommodities();
        }
        //删除商品
        public int DeleteCommodity(int id)
        {
            return dal.DeleteCommodity(id);
        }

    }
}
